package com.zj.jdbc3Batis.dao;

import com.zj.bean.UserInfo;
import com.zj.jdbc3Batis.tools.annotations.Select;
import com.zj.jdbc3Batis.tools.annotations.Update;

import java.util.List;

public interface UserDao {

    @Update("insert into user_inf(name,sex,phoneNumber,birthday) values(?,?,?,?)")
    public int addUser(UserInfo user);

    @Update("delete from user_inf where id=?")
    public int deleteUser(int id) ;

    @Update("update user_inf set name=#{0.name},birthday=#{0.birthday} ,sex=#{0.sex} where id=#{1}")
    public int updateUser(UserInfo user,int id);

    @Select("select * from user_inf where id=#{0}")
    public UserInfo findUserById(int id) ;

    @Select("select * from user_inf where sex=#{0} and birthday<#{1}")
    public List<UserInfo> findUserBySexAndBir(String sex,String birthday) ;

    @Select("select name from user_inf where sex=#{0}")
    public List<String> findUserNameBySex(String sex) ;


    @Select("select * from user_inf")
    public List<UserInfo> getAllUser();
}